pub fn convert_base(num_str: &str, to_base: u32) -> String {
  let mut sp = num_str.split('(');
  let num = sp.next().unwrap();
  let base = sp.next().unwrap();
  let base  = base[..base.len() - 1].parse().unwrap();
  let mut x = 0;
  for c in num.chars() {
    x = x * base + c.to_digit(base).unwrap();
  }
  let mut res = String::new();
  while x != 0 {
    let r = (x % to_base) as u8;
    x /= to_base;
    let c;
    if r <= 9 {
      c = (r + '0' as u8) as char;
    } else {
      c = (r + 'a' as u8 - 10) as char;
    }
    res.insert(0, c);
  }
  res
}
